<!DOCTYPE html>
<html lang="zh" xmlns:th="https://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
    <title>微笑计划管理后台 </title>
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link href="https://fonts.googleapis.com/css?family=Nunito:400,600,700" rel="stylesheet">
    <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/plugins.css" rel="stylesheet" type="text/css" />
    <!-- END GLOBAL MANDATORY STYLES -->

    <!-- BEGIN PAGE LEVEL CUSTOM STYLES -->
    <link rel="stylesheet" type="text/css" href="/plugins/table/datatable/datatables.css">
    <link rel="stylesheet" type="text/css" href="/plugins/table/datatable/custom_dt_html5.css">
    <link rel="stylesheet" type="text/css" href="/plugins/table/datatable/dt-global_style.css">
    <link th:href="@{/plugins/notification/snackbar/snackbar.min.css}" rel="stylesheet" type="text/css" />

    <link href="/plugins/animate/animate.css" rel="stylesheet" type="text/css" />
    <script src="/plugins/sweetalerts/promise-polyfill.js"></script>
    <link href="/plugins/sweetalerts/sweetalert2.min.css" rel="stylesheet" type="text/css" />
    <link href="/plugins/sweetalerts/sweetalert.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/components/custom-sweetalert.css" rel="stylesheet" type="text/css" />


    <link rel="stylesheet" type="text/css" href="/plugins/bootstrap-select/bootstrap-select.min.css">
    <!-- END PAGE LEVEL CUSTOM STYLES -->
</head>
<style>
    img{
        width: auto;
        height: 50px;
    }
    .file {
        position: relative;
        display: inline-block;
        background: #D0EEFF;
        border: 1px solid #99D3F5;
        border-radius: 4px;
        padding: 4px 12px;
        overflow: hidden;
        color: #1E88C7;
        text-decoration: none;
        text-indent: 0;
        line-height: 20px;
    }
    .file input {
        position: absolute;
        font-size: 100px;
        right: 0;
        top: 0;
        opacity: 0;
    }
    .file:hover {
        background: #AADFFD;
        border-color: #78C3F3;
        color: #004974;
        text-decoration: none;
    }
    .imgShowDiv{
        display: flex;
        justify-content: flex-start;
        flex-direction: column;
    }
    .imgShow{
    }
    .images{
        display: flex;
        border-color: #060606;
        border-style: solid;
        border-width: thin;
    }
    .imgShow{
        padding-bottom: 15px;
        padding-top: 15px;
    }
</style>
<body class="sidebar-noneoverflow">

    <!--  BEGIN NAVBAR  -->
    <div class="header-container fixed-top">
        <header class="header navbar navbar-expand-sm">
            <a href="javascript:void(0);" class="sidebarCollapse" data-placement="bottom"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></a>
            <ul class="navbar-item flex-row">
            </ul>
            <ul class="navbar-item flex-row search-ul">
            </ul>
            <ul class="navbar-item flex-row navbar-dropdown">
                <li class="nav-item dropdown user-profile-dropdown  order-lg-0 order-1">
                    <a href="javascript:void(0);" class="nav-link dropdown-toggle user" id="userProfileDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>
                    </a>
                    <div class="dropdown-menu position-absolute" aria-labelledby="userProfileDropdown">
                        <div class="">
                            <div class="dropdown-item">
                                <a class="" href="/admin/userinfo"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>个人资料</a>
                            </div>
                            <div class="dropdown-item">
                                <a class="" href="/addmin/out"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>退出登录</a>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </header>
    </div>
    <!--  END NAVBAR  -->

    <!--  BEGIN MAIN CONTAINER  -->
    <div class="main-container" id="container">

        <div class="overlay"></div>
        <div class="cs-overlay"></div>
        <div class="search-overlay"></div>

        <!--  BEGIN SIDEBAR  -->
        <div class="sidebar-wrapper sidebar-theme">

            <nav id="sidebar">

               <ul class="navbar-nav theme-brand flex-row  text-center">

                   <li class="nav-item theme-text">
                       <a href="/admin" class="nav-link"> 微笑计划 </a>
                   </li>
                   <li class="nav-item toggle-sidebar">
                       <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left sidebarCollapse"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>
                   </li>
               </ul>

                <div class="shadow-bottom"></div>


                <ul class="list-unstyled menu-categories" id="accordionExample">

					<li class="menu">
					    <a href="#dashboard" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle collapsed">
					        <div class="">
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>
					            <span>仪表盘</span>
					        </div>
					        <div>
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
					        </div>
					    </a>
					    <ul class="submenu recent-submenu mini-recent-submenu list-unstyled collapse" id="dashboard" data-parent="#accordionExample">
					        <li class="active">
					            <a href="/admin"> 数据统计 </a>
					        </li>
					    </ul>
					</li>

					<li class="menu ">
					    <a href="#userMager" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle collapsed">
					        <div class="">
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>
                                    <span>会员</span><span>会员</span>
					        </div>
					        <div>
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
					        </div>
					    </a>
						<ul class="submenu recent-submenu mini-recent-submenu list-unstyled collapse" id="userMager" data-parent="#accordionExample">
							<li class="">
								<a href="/admin/userList"> 会员列表 </a>
							</li>
                            <li class="">
                                <a href="/admin/userListAngel"> 天使列表 </a>
                            </li>
                            <li class="">
                                <a href="/admin/userListCity"> 市代列表 </a>
                            </li>
                            <li class="">
                                <a href="/admin/userListProvince"> 省代列表 </a>
                            </li>
                            <li class="">
                                <a href="/admin/userListPartner"> 分公司列表 </a>
                            </li>
						</ul>
					</li>





					<li class="menu">
					    <a href="#shopMager" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle collapsed">
					        <div class="">
					            <svg t="1616857683050" class="icon" viewBox="0 0 1170 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3316" width="108" height="108"><path d="M103.619 387.95c1.658 107.617 43.057 155.16 129.95 155.16 94.404 0 145.457-28.282 161.597-83.87l25.942-89.527 29.842 88.259c19.505 57.539 62.123 85.138 134.632 85.138 72.996 0 118.004-28.087 140.922-86.455l22.43-57.051 30.232 53.345c53.151 93.672 115.42 122.051 194.707 92.063 78.458-29.647 107.276-89.332 88.259-188.855l-139.8-259.755H251.513L103.619 387.998z m129.95 213.674c-123.66 0-188.562-77.921-188.562-220.55v-7.07l155.16-305.737a55.442 55.442 0 0 1 49.494-30.379h674.572c20.383 0 39.107 11.215 48.762 29.16l142.775 265.264 2.926 8.095c25.99 128.634-16.043 218.502-124.1 259.364-93.964 35.5-175.201 8.875-238.494-75.337-36.815 51.103-94.598 77.19-170.472 77.19-72.411 0-127.414-23.893-162.182-70.558-37.059 47.153-101.522 70.558-189.83 70.558z m-115.224 83.773a29.257 29.257 0 1 1 58.514 0v228.304c0 12.678 10.338 23.064 23.114 23.064h754.736a23.064 23.064 0 0 0 23.065-23.064V685.397a29.257 29.257 0 1 1 58.514 0v228.304c0 45.056-36.523 81.578-81.579 81.578H199.973c-45.105 0-81.628-36.571-81.628-81.578V685.397z" p-id="3317" fill="#888ea8"></path><path d="M243.76 358.205a29.257 29.257 0 1 1 0-58.514h669.16a29.257 29.257 0 1 1 0 58.514H243.76z" p-id="3318" fill="#888ea8"></path></svg>
					            <span>商城</span>
					        </div>
					        <div>
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
					        </div>
					    </a>
					    <ul class="submenu recent-submenu mini-recent-submenu list-unstyled collapse" id="shopMager" data-parent="#accordionExample">
                            <li class="">
                                <a href="/admin/shopGoodsMenu"> 商品分类 </a>
                            </li>
                            <li class="">
					            <a href="/admin/shopGoodsList"> 商品管理 </a>
					        </li>
							<li class="">
							    <a href="/admin/shopOrderList?type=3"> 订单管理（全部） </a>
							</li>
							<li class="">
								<a href="/admin/shopOrderList?type=0"> 待发货 </a>
							</li>
							<li class="">
								<a href="/admin/shopOrderList?type=1"> 待收货 </a>
							</li>
							<li class="">
								<a href="/admin/shopOrderList?type=2"> 已完成 </a>
							</li>
					    </ul>
					</li>


					<li class="menu active">
					    <a href="#uniappMager" data-toggle="collapse" aria-expanded="true" class="dropdown-toggle ">
					        <div class="">
					            <svg t="1616857400944" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2079" width="108" height="108"><path d="M512 64c247.424 0 448 200.576 448 448S759.424 960 512 960 64 759.424 64 512 264.576 64 512 64z m0 64c-212.077 0-384 171.923-384 384s171.923 384 384 384 384-171.923 384-384-171.923-384-384-384z m104.284 141.363c74.637 0 135.363 60.726 135.363 135.363 0 52.558-30.834 100.8-78.545 122.887a31.842 31.842 0 0 1-13.405 2.966 31.958 31.958 0 0 1-29.026-18.542c-7.341-15.858-0.58-34.636 15.099-42.206l0.477-0.226c25.2-11.665 41.477-37.128 41.477-64.88 0-39.394-32.045-71.439-71.44-71.439-39 0-70.798 31.408-71.43 70.26l-0.01 1.18c0 0.879-0.043 1.792-0.128 2.78l-0.01 0.214V618.04h-0.362v2.5c0 74.638-60.726 135.363-135.362 135.363-74.637 0-135.363-60.725-135.363-135.362 0-52.586 30.856-100.838 78.601-122.915 16.02-7.41 35.015-0.427 42.425 15.596 7.335 15.862 0.565 34.637-15.118 42.2l-0.478 0.225c-25.217 11.66-41.507 37.127-41.507 64.894 0 39.394 32.045 71.439 71.44 71.439 39.394 0 71.439-32.045 71.439-71.44 0-1.603 0.12-3.205 0.358-4.791l0.028-0.185-0.001-208.338h0.116v-2.5c0-73.89 59.516-134.146 133.127-135.344l2.235-0.018z" p-id="2080" fill="#888ea8"></path></svg>
					            <span>小程序</span>
					        </div>
					        <div>
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
					        </div>
					    </a>
					    <ul class="collapse submenu recent-submenu mini-recent-submenu list-unstyled show" id="uniappMager" data-parent="#accordionExample">
					        <li class="">
					            <a href="uniIndex"> 首页排版 </a>
					        </li>
							<li class="active">
					            <a href="/admin/uniSwiper"> 首页轮播 </a>
					        </li>
							<li class="">
							    <a href="uniHome"> 微笑计划排版 </a>
							</li>
					    </ul>
					</li>


					<li class="menu">
					    <a href="#articleMager" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle collapsed">
					        <div class="">
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
					            <span>文章管理</span>
					        </div>
					        <div>
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
					        </div>
					    </a>
					    <ul class="submenu recent-submenu mini-recent-submenu list-unstyled collapse" id="articleMager" data-parent="#accordionExample">
					        <li class="">
								<a href="/admin/articleList"> 文章列表 </a>
					        </li>
						</ul>
					</li>

					<li class="menu">
					    <a href="#moneyMager" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle collapsed">
					        <div class="">
					            <svg t="1616857765295" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4246" width="108" height="108"><path d="M639.414168 336.899827H588.780264a16.618153 16.618153 0 0 0-14.739492 8.733774L511.795146 463.669454l-62.235633-118.035853a16.618153 16.618153 0 0 0-14.739492-8.733774h-50.643897a7.994301 7.994301 0 0 0-7.374742 11.621715l73.947284 140.270003h-50.873733a15.988602 15.988602 0 0 0-15.988602 15.988602v23.982903a15.988602 15.988602 0 0 0 15.988602 15.988602h79.943009v47.965805h-79.943009a15.988602 15.988602 0 0 0-15.988602 15.988602v23.982903a15.988602 15.988602 0 0 0 15.988602 15.988602h79.943009v63.954407a15.988602 15.988602 0 0 0 15.988602 15.988602h31.977204a15.988602 15.988602 0 0 0 15.988602-15.988602v-63.954407h79.943009a15.988602 15.988602 0 0 0 15.988602-15.988602v-23.982903a15.988602 15.988602 0 0 0-15.988602-15.988602h-79.943009v-47.965805h79.943009a15.988602 15.988602 0 0 0 15.988602-15.988602v-23.982903a15.988602 15.988602 0 0 0-15.988602-15.988602h-50.883725l73.947283-140.270003a7.994301 7.994301 0 0 0-7.364749-11.621715z" p-id="4247" fill="#888ea8"></path><path d="M511.405424 113.059401c-220.752628 0-399.715047 178.962419-399.715047 399.715047s178.962419 399.715047 399.715047 399.715047 399.715047-178.962419 399.715047-399.715047-178.962419-399.715047-399.715047-399.715047zM754.462151 755.851161A342.505831 342.505831 0 1 1 828.169606 646.539088 342.67571 342.67571 0 0 1 754.462151 755.851161z" p-id="4248" fill="#888ea8"></path></svg>
					            <span>资金记录</span>
					        </div>
					        <div>
					            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
					        </div>
					    </a>
					    <ul class="submenu recent-submenu mini-recent-submenu list-unstyled collapse" id="moneyMager" data-parent="#accordionExample">
							<li class="">
								<a href="/admin/shopCzList"> 充值记录 </a>
							</li>
							<li class="">
								<a href="/admin/shopSyList"> 收益记录 </a>
							</li>
						</ul>
					</li>

                </ul>
            </nav>

        </div>
        <!--  END SIDEBAR  -->

        <!--  BEGIN CONTENT AREA  -->
        <div id="content" class="main-content">



            <!-- Modal -->
            <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel">添加轮播</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            </button>
                        </div>
                        <div class="modal-body">

                            <div class="form-group">
                                <label>选择文章</label>
                            </div>
                            <select class="selectpicker" id="article">
                                <option th:each="opt:${articleList}" th:attr="data-id=${opt.id}" th:text="${opt.title}" ></option>
                            </select>

                            <div class="form-group">
                                <label>图片</label>

                                <div id="imgSelect" style="width:100%">
                                    <a href="javascript:;" class="file">选择文件
                                        <input type="file" id="img" accept="image/*">
                                    </a>
                                </div>
                                <div id="imgShowDiv" class="imgShowDiv" style="display:inline-grid;display:none">
                                    <div id="imgShow" class="imgShow" style="width:100%">
                                    </div>
                                    <button class="btn btn-danger mb-2" onclick="delImg('img')">删除</button>
                                </div>
                            </div>

                            <div class="form-group">
                                <label >排序</label>
                                <input type="number" class="form-control" id="sort" value="0">
                                <small id="sorts" class="form-text text-muted">越小越靠前</small>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button class="btn" data-dismiss="modal" onclick="clear()"><i class="flaticon-cancel-12"></i> 关闭</button>
                            <button type="button" class="btn btn-primary" onclick="add()">添加</button>
                        </div>
                    </div>
                </div>
            </div>







            <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" >编辑轮播</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            </button>
                        </div>
                        <div class="modal-body">

                            <div class="form-group">
                                <label>选择文章</label>
                            </div>
                            <select class="selectpicker" id="editArticle">
                                <option th:each="opt:${articleList}" th:attr="data-id=${opt.id}" th:text="${opt.title}" ></option>
                            </select>

                            <div class="form-group">
                                <label>图片</label>

                                <div id="editImgSelect" style="width:100%">
                                    <a href="javascript:;" class="file">选择文件
                                        <input type="file" id="editImg" accept="image/*">
                                    </a>
                                </div>

                                <div id="editImgShowDiv" class="imgShowDiv" style="display:inline-grid">
                                    <div id="editImgShow" class="imgShow" style="width:100%">
                                        <img name='img' id="editImgUrl" style='height:100px'/>
                                    </div>
                                    <button class="btn btn-danger mb-2" onclick="delImg('editImg')">删除</button>
                                </div>
                            </div>

                            <div class="form-group">
                                <label >排序</label>
                                <input type="number" class="form-control" id="editSort" value="0">
                                <small class="form-text text-muted">越小越靠前</small>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button class="btn" data-dismiss="modal" onclick="editClear()"><i class="flaticon-cancel-12"></i> 关闭</button>
                            <button type="button" class="btn btn-primary" onclick="save()">保存</button>
                        </div>
                    </div>
                </div>
            </div>


            <div class="layout-px-spacing">

                <div class="row layout-top-spacing" id="cancel-row">

                    <div class="col-xl-12 col-lg-12 col-sm-12  layout-spacing">
                        <div class="widget-content widget-content-area br-6">

                            <button class="btn btn-primary mb-2" data-toggle="modal" data-target="#exampleModal"  >添加轮播</button>

                            <div class="table-responsive mb-4 mt-4">
                                <table id="html5-extension" class="table table-hover non-hover" style="width:100%">
                                    <thead>
                                        <tr>
                                            <th></th>
                                            <th></th>
                                            <th>图片</th>
                                            <th>跳转文章</th>
                                            <th>排序</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr th:each="swiper:${swiperList}">
                                            <td></td>
                                            <td></td>
                                            <td>
                                                <img class="img" th:src="${swiper.image}">
                                            </td>
                                            <td th:text="${swiper.url}"></td>
                                            <td th:text="${swiper.sort}"></td>
                                            <td>
                                                <button class="btn btn-primary mb-2" data-toggle="modal" data-target="#editModal" th:onclick="edit([[${swiper.id}]],[[${swiper.url}]],[[${swiper.image}]],[[${swiper.sort}]])">编辑</button>
												<button class="btn btn-warning mb-2" th:onclick="isDel([[${swiper.id}]])">删除</button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

                </div>

                </div>
            <div class="footer-wrapper">
                <div class="footer-section f-section-1">
                    <p class="">Copyright © 2021 郑州灵之动网络科技有限公司</p>
                </div>

            </div>
        </div>
        <!--  END CONTENT AREA  -->

    </div>
    <!-- END MAIN CONTAINER -->


    <!-- BEGIN GLOBAL MANDATORY SCRIPTS -->
    <script src="/plugins/sweetalerts/sweetalert2.min.js"></script>
    <script th:src="@{/plugins/notification/snackbar/snackbar.min.js}"></script>
    <script src="/assets/js/libs/jquery-3.1.1.min.js"></script>
    <script src="/bootstrap/js/popper.min.js"></script>
    <script src="/bootstrap/js/bootstrap.min.js"></script>
    <script src="/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
    <script src="/assets/js/app.js"></script>


    <script src="/assets/js/scrollspyNav.js"></script>
    <script src="/plugins/bootstrap-select/bootstrap-select.min.js"></script>
    <script>
    </script>
    <script>
        $(document).ready(function() {
            App.init();
        });
        var id;
        var articleId = 0;
        var images = '';
        var sort = 0;
        $("#article").change(function(){
            var $input = $("#article").find("option:selected");
            articleId = $input.attr("data-id")
        });
        $("#editArticle").change(function(){
            var $input = $("#editArticle").find("option:selected");
            articleId = $input.attr("data-id")
        });

        $(function () {
            var $image =  $("#editImg");
            $image.change(function () {
                if($(this).val() != ""){
                    var formdata=new FormData();
                    var img = $image.get(0).files[0];
                    if (!img) {
                        Snackbar.show({
                            text: "请选择图片",
                            pos: 'top-center'
                        });
                        return false;
                    }
                    formdata.append('img', img);
                    $.ajax({
                        async: false,
                        type: 'POST',
                        url: "/admin/uploadImg",
                        dataType: 'json',
                        data: formdata,
                        contentType:false,//ajax上传图片需要添加
                        processData:false,//ajax上传图片需要添加
                        success: function (data) {
                            if(data.code == "200"){
                                $("#editImgShowDiv").show();
                                $("#editImgShow").html("<img name='imgs' class='images' src='"+data.data+"' style='height:200px'/>");
                                $("#editImgSelect").hide();
                                $('#editImg').val("");
                                images = data.data;
                            }
                            else {
                                $("#editImgShow").html("上传失败");
                            }
                        },
                        error: function (e) {
                            alert("error");
                        }
                    })
                }
            })


            var $input =  $("#img");
            $input.change(function () {
                if($(this).val() != ""){
                    var formdata=new FormData();
                    var img = $input.get(0).files[0];
                    if (!img) {
                        Snackbar.show({
                            text: "请选择图片",
                            pos: 'top-center'
                        });
                        return false;
                    }
                    formdata.append('img', img);
                    $.ajax({
                        async: false,
                        type: 'POST',
                        url: "/admin/uploadImg",
                        dataType: 'json',
                        data: formdata,
                        contentType:false,//ajax上传图片需要添加
                        processData:false,//ajax上传图片需要添加
                        success: function (data) {
                            if(data.code == "200"){
                                $("#imgShowDiv").show();
                                $("#imgShow").html("<img name='img' class='images' src='"+data.data+"' style='height:200px'/>");
                                $("#imgSelect").hide();
                                $('#img').val("");
                                images = data.data;
                            }
                            else {
                                $("#imgShow").html("上传失败");
                            }
                        },
                        error: function (e) {
                            alert("error");
                        }
                    })
                }
            })
        })
        function delImg(imgItem) {
            $("#" + imgItem + "ShowDiv").hide();
            $("#" + imgItem + "Select").show();
            images = '';
        }
        function add() {
            if (articleId==0) {
                console.log(articleId)
                Snackbar.show({
                    text: "请选择文章",
                    pos: 'top-center'
                });
                return false;
            }if (images=="") {
                Snackbar.show({
                    text: "请上传图片",
                    pos: 'top-center'
                });
                return false;
            }
            $.ajax({
                url: "/admin/addSwiper",
                method: "POST",
                data:{gid:articleId,img:images,sort:sort},
                header: {
                    'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
                },
                success: function (result) {
                    if(result.code == "500"){
                        Snackbar.show({
                            text: result.msg,
                            pos: 'top-center'
                        });
                        setTimeout(function (){
                            window.location.reload();
                        }, 1500);
                    }else if(result.code == "200"){
                        Snackbar.show({
                            text: '添加成功',
                            pos: 'top-center'
                        });
                        setTimeout(function (){
                            window.location.reload();
                        }, 1500);
                    }else if(result.code == "100"){
                        Snackbar.show({
                            text: "您已掉线！",
                            pos: 'top-center'
                        });
                        setTimeout(function (){
                            window.location.href="/admin/login";
                        }, 1500);
                    }
                },
                error : function() {
                    Snackbar.show({
                        text: '请稍后再试',
                        pos: 'top-center'
                    });
                    setTimeout(function (){
                        window.location.reload();
                    }, 1500);
                }
            })

        }
        function save() {
            sort = $("#editSort").val();
            if (id==0) {
                Snackbar.show({
                    text: "请选择修改记录",
                    pos: 'top-center'
                });
                return false;
            }
            if (articleId==0) {
                Snackbar.show({
                    text: "请选择文章",
                    pos: 'top-center'
                });
                return false;
            }if (images=="") {
                Snackbar.show({
                    text: "请上传图片",
                    pos: 'top-center'
                });
                return false;
            }
            $.ajax({
                url: "/admin/updSwiper",
                method: "POST",
                data:{id:id,gid:articleId,img:images,sort:sort},
                header: {
                    'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
                },
                success: function (result) {
                    if(result.code == "500"){
                        Snackbar.show({
                            text: result.msg,
                            pos: 'top-center'
                        });
                        setTimeout(function (){
                            window.location.reload();
                        }, 1500);
                    }else if(result.code == "200"){
                        Snackbar.show({
                            text: '修改成功',
                            pos: 'top-center'
                        });
                        setTimeout(function (){
                            window.location.reload();
                        }, 1500);
                    }else if(result.code == "100"){
                        Snackbar.show({
                            text: "您已掉线！",
                            pos: 'top-center'
                        });
                        setTimeout(function (){
                            window.location.href="/admin/login";
                        }, 1500);
                    }
                },
                error : function() {
                    Snackbar.show({
                        text: '请稍后再试',
                        pos: 'top-center'
                    });
                    setTimeout(function (){
                        window.location.reload();
                    }, 1500);
                }
            })

        }
		function edit(i,gid,img,so) {
            $("#editImgUrl").attr('src',img);
            $("#editSort").val(so);
            id = i;
            articleId = gid;
            images = img;
            sort = so;
		}
		function isDel(id) {
            swal({
                title: '删除提示?',
                text: "你确定要删除这条记录吗!",
                type: 'warning',
                showCancelButton: true,
                confirmButtonText: '删除',
                cancelButtonText: '取消',
                padding: '2em'
            }).then(function(result) {
                if (result.value) {
                    $.ajax({
                        url: "/admin/delSwiper",
                        method: "POST",
                        data:{id:id},
                        header: {
                            'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
                        },
                        success: function (result) {
                            if(result.code == "500"){
                                Snackbar.show({
                                    text: result.msg,
                                    pos: 'top-center'
                                });
                                setTimeout(function (){
                                    window.location.reload();
                                }, 1500);
                            }else if(result.code == "200"){
                                Snackbar.show({
                                    text: '删除成功',
                                    pos: 'top-center'
                                });
                                setTimeout(function (){
                                    window.location.reload();
                                }, 1500);
                            }else if(result.code == "100"){
                                Snackbar.show({
                                    text: "您已掉线！",
                                    pos: 'top-center'
                                });
                                setTimeout(function (){
                                    window.location.href="/admin/login";
                                }, 1500);
                            }
                        },
                        error : function() {
                            Snackbar.show({
                                text: '请稍后再试',
                                pos: 'top-center'
                            });
                            setTimeout(function (){
                                window.location.reload();
                            }, 1500);
                        }
                    })

                }
            })
        }
        function clear() {
			id = 0;
            articleId = 0;
            images = '';
            sort = 0;
		}


    </script>
</body>
</html>
